﻿/**
 * 
 * Copyright 2009, 2010 Mike Jamer [email: mikejamer@gmail.com ]
 * 
 * This File is part of Moose IRC
 * 
 * MooseIRC is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * MooseIRC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with MooseIRC.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using moose.irc;

namespace TestChannelStructure {

    /// <summary>
    /// Form used to debug messages, and message parsing
    /// </summary>
    public partial class MessageDebugForm : Form {

        #region [Construction]

        /// <summary>
        /// Initialize Parse Message Form
        /// </summary>
        public MessageDebugForm() {
            InitializeComponent();
            return;
        }

        #endregion

        #region [Form Events]

        /// <summary>
        /// Fires when Parse Message is clicked
        /// </summary>
        private void cmdParseMessage_Click(object sender, EventArgs e) {

            IrcMessage message = new IrcMessage(txtInput.Text);
            txtSource.Text = message.Source;
            txtCommand.Text = message.Command;
            lstArguments.Items.Clear();
            foreach (string arg in message.Arguments)
                lstArguments.Items.Add(arg);

            return;
        }

        /// <summary>
        /// Fires when Parse Source is clicked
        /// </summary>
        private void cmdParseSource_Click(object sender, EventArgs e) {
            using(EntityDebugForm frm = new EntityDebugForm(txtSource.Text) ) {
                frm.ShowDialog(this);    
            }
            return;
        }

        #endregion

    }
}
